home *** CD-ROM | disk | FTP | other *** search
/ Young Minds / Young Minds Interactive CD-ROM.ISO / omega / ocity.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-08-06  |  16.4 KB  |  639 lines

  1. /* omega copyright (C) by Laurence Raphael Brothers, 1987,1988 */
  2. /* ocity.c */
  3. /* some functions to make the city level */
  4.  
  5. #include "oglob.h"
  6.  
  7.  
  8. /* loads the city level */
  9. void load_city()
  10. {
  11.   int i,j;
  12.   pml ml;
  13.   char site;
  14.   
  15.   FILE *fd;
  16.   
  17.   for(i=0;i<NUMCITYSITES;i++) 
  18.     CitySiteList[i][0] = FALSE;
  19.  
  20.   strcpy(Str3,OMEGALIB);
  21.   strcat(Str3,"ocity.dat");
  22.   fd = fopen(Str3,"r");
  23.  
  24.  
  25.   TempLevel = Level;
  26.   if (ok_to_free(TempLevel)) {
  27.     free((char *) TempLevel);
  28.     TempLevel = NULL;
  29.   }
  30.   Level = ((plv) malloc(sizeof(levtype)));
  31.   clear_level(Level);
  32.   Level->environment = E_CITY;
  33.   for(j=0;j<LENGTH;j++) {
  34.     for(i=0;i<WIDTH;i++) {
  35.       lset(i,j,SEEN);
  36.       site = getc(fd);
  37.  
  38.       switch(site) {
  39.       case 'g':
  40.     Level->site[i][j].locchar = FLOOR;
  41.     Level->site[i][j].p_locf = L_GARDEN;
  42.     break;
  43.       case 'z':
  44.     Level->site[i][j].locchar = FLOOR;
  45.     Level->site[i][j].p_locf = L_MAZE;
  46.     break;
  47.       case 'y':
  48.     Level->site[i][j].locchar = FLOOR;
  49.     Level->site[i][j].p_locf = L_CEMETARY;
  50.     break;
  51.       case 'x':
  52.     assign_city_function(i,j);
  53.     break;
  54.       case 't':
  55.     Level->site[i][j].locchar = FLOOR;
  56.     Level->site[i][j].p_locf = L_TEMPLE;
  57.     CitySiteList[L_TEMPLE-CITYSITEBASE][0] = TRUE;
  58.     CitySiteList[L_TEMPLE-CITYSITEBASE][1] = i;
  59.     CitySiteList[L_TEMPLE-CITYSITEBASE][2] = j;
  60.     break;
  61.       case 'T':
  62.     Level->site[i][j].locchar = FLOOR;
  63.     Level->site[i][j].p_locf = L_PORTCULLIS_TRAP;
  64.     Level->site[i][j].aux = NOCITYMOVE;
  65.     break;
  66.       case 'R':
  67.     Level->site[i][j].locchar = FLOOR;
  68.     Level->site[i][j].p_locf = L_RAISE_PORTCULLIS;
  69.     Level->site[i][j].aux = NOCITYMOVE;
  70.     break;
  71.       case '7':
  72.     Level->site[i][j].locchar = FLOOR;
  73.     Level->site[i][j].p_locf = L_PORTCULLIS;
  74.     Level->site[i][j].aux = NOCITYMOVE;
  75.     break;
  76.       case 'C':
  77.     Level->site[i][j].locchar = OPEN_DOOR;
  78.     Level->site[i][j].p_locf = L_COLLEGE;
  79.     CitySiteList[L_COLLEGE-CITYSITEBASE][0] = TRUE;
  80.     CitySiteList[L_COLLEGE-CITYSITEBASE][1] = i;
  81.     CitySiteList[L_COLLEGE-CITYSITEBASE][2] = j;
  82.     break;
  83.       case 's':
  84.     Level->site[i][j].locchar = OPEN_DOOR;
  85.     Level->site[i][j].p_locf = L_SORCERORS;
  86.     CitySiteList[L_SORCERORS-CITYSITEBASE][0] = TRUE;
  87.     CitySiteList[L_SORCERORS-CITYSITEBASE][1] = i;
  88.     CitySiteList[L_SORCERORS-CITYSITEBASE][2] = j;
  89.     break;
  90.       case 'M':
  91.     Level->site[i][j].locchar = OPEN_DOOR;
  92.     Level->site[i][j].p_locf = L_MERC_GUILD;
  93.     CitySiteList[L_MERC_GUILD-CITYSITEBASE][0] = TRUE;
  94.     CitySiteList[L_MERC_GUILD-CITYSITEBASE][1] = i;
  95.     CitySiteList[L_MERC_GUILD-CITYSITEBASE][2] = j;
  96.     break;
  97.       case 'c':
  98.     Level->site[i][j].locchar = OPEN_DOOR;
  99.     Level->site[i][j].p_locf = L_CASTLE;
  100.     CitySiteList[L_CASTLE-CITYSITEBASE][0] = TRUE;
  101.     CitySiteList[L_CASTLE-CITYSITEBASE][1] = i;
  102.     CitySiteList[L_CASTLE-CITYSITEBASE][2] = j;
  103.     break;
  104.       case '?':
  105.     mazesite(i,j);
  106.     break;
  107.       case 'P':
  108.         Level->site[i][j].locchar = OPEN_DOOR;
  109.     Level->site[i][j].p_locf = L_ORDER;
  110.     CitySiteList[L_ORDER-CITYSITEBASE][0] = TRUE;
  111.     CitySiteList[L_ORDER-CITYSITEBASE][1] = i;
  112.     CitySiteList[L_ORDER-CITYSITEBASE][2] = j;
  113.     break;
  114.       case 'H':
  115.         Level->site[i][j].locchar = OPEN_DOOR;
  116.     Level->site[i][j].p_locf = L_CHARITY;
  117.     CitySiteList[L_CHARITY-CITYSITEBASE][0] = TRUE;
  118.     CitySiteList[L_CHARITY-CITYSITEBASE][1] = i;
  119.     CitySiteList[L_CHARITY-CITYSITEBASE][2] = j;
  120.     break;
  121.       case 'j':
  122.         Level->site[i][j].locchar = FLOOR;
  123.     make_justiciar(i,j);
  124.         break;
  125.       case 'J':
  126.     Level->site[i][j].locchar = CLOSED_DOOR;
  127.     Level->site[i][j].p_locf = L_JAIL;
  128.     break;
  129.       case 'A':
  130.     Level->site[i][j].locchar = OPEN_DOOR;
  131.     Level->site[i][j].p_locf = L_ARENA;
  132.     CitySiteList[L_ARENA-CITYSITEBASE][0] = TRUE;
  133.     CitySiteList[L_ARENA-CITYSITEBASE][1] = i;
  134.     CitySiteList[L_ARENA-CITYSITEBASE][2] = j;
  135.     break;
  136.       case 'B':
  137.     Level->site[i][j].locchar = OPEN_DOOR;
  138.     Level->site[i][j].p_locf = L_BANK;
  139.     CitySiteList[L_BANK-CITYSITEBASE][0] = TRUE;
  140.     CitySiteList[L_BANK-CITYSITEBASE][1] = i;
  141.     CitySiteList[L_BANK-CITYSITEBASE][2] = j;
  142.     lset(i,j+1,STOPS);
  143.     lset(i+1,j,STOPS);
  144.     lset(i-1,j,STOPS);
  145.     lset(i,j-1,STOPS);
  146.     break;
  147.       case 'X':
  148.     Level->site[i][j].locchar = FLOOR;
  149.     Level->site[i][j].p_locf = L_COUNTRYSIDE;
  150.     CitySiteList[L_COUNTRYSIDE-CITYSITEBASE][0] = TRUE;
  151.     CitySiteList[L_COUNTRYSIDE-CITYSITEBASE][1] = i;
  152.     CitySiteList[L_COUNTRYSIDE-CITYSITEBASE][2] = j;
  153.     break;
  154.       case 'V':
  155.     Level->site[i][j].locchar = FLOOR;
  156.     Level->site[i][j].p_locf = L_VAULT;
  157.     Level->site[i][j].aux = NOCITYMOVE;
  158.     lset(i,j,SECRET);
  159.     break;
  160.       case '\\':
  161.     Level->site[i][j].aux = NOCITYMOVE;
  162.     Level->site[i][j].showchar = WALL;
  163.     Level->site[i][j].locchar = CLOSED_DOOR;
  164.     Level->site[i][j].p_locf = L_VAULT;
  165.     lset(i,j,SECRET);
  166.     break;
  167.       case 'S':
  168.     Level->site[i][j].locchar = FLOOR;
  169.     Level->site[i][j].aux = NOCITYMOVE;
  170.     lset(i,j,SECRET);
  171.     break;
  172.       case 'G':
  173.     Level->site[i][j].locchar = FLOOR;
  174.     make_site_monster(i,j,ML0+3);
  175.     break;
  176.       case 'u':
  177.     Level->site[i][j].locchar = FLOOR;
  178.     make_minor_undead(i,j);
  179.     break;
  180.       case 'U':
  181.     Level->site[i][j].locchar = FLOOR;
  182.     make_major_undead(i,j);
  183.     break;
  184.       case '%':
  185.     Level->site[i][j].showchar = WALL;
  186.     Level->site[i][j].locchar = FLOOR;
  187.     Level->site[i][j].p_locf = L_TRAP_SIREN;
  188.     make_site_treasure(i,j,5);
  189.     Level->site[i][j].aux = NOCITYMOVE;
  190.     lset(i,j,SECRET);
  191.     break;
  192.       case '$':
  193.     Level->site[i][j].locchar = FLOOR;
  194.     make_site_treasure(i,j,5);
  195.     break;
  196.       case '2':
  197.     Level->site[i][j].locchar = ALTAR;
  198.     Level->site[i][j].p_locf = L_ALTAR;
  199.     Level->site[i][j].aux = ODIN;
  200.     break;
  201.       case '3':
  202.     Level->site[i][j].locchar = ALTAR;
  203.     Level->site[i][j].p_locf = L_ALTAR;
  204.     Level->site[i][j].aux = SET;
  205.     break;
  206.       case '4':
  207.     Level->site[i][j].locchar = ALTAR;
  208.     Level->site[i][j].p_locf = L_ALTAR;
  209.     Level->site[i][j].aux = ATHENA;
  210.     break;
  211.       case '5':
  212.     Level->site[i][j].locchar = ALTAR;
  213.     Level->site[i][j].p_locf = L_ALTAR;
  214.     Level->site[i][j].aux = HECATE;
  215.     break;
  216.       case '6':
  217.     Level->site[i][j].locchar = ALTAR;
  218.     Level->site[i][j].p_locf = L_ALTAR;
  219.     Level->site[i][j].aux = DESTINY;
  220.     break;
  221.       case 'O':
  222.     Level->site[i][j].locchar = OPEN_DOOR;
  223.     Level->site[i][j].p_locf = L_ORACLE;
  224.     CitySiteList[L_ORACLE-CITYSITEBASE][1] = i;
  225.     CitySiteList[L_ORACLE-CITYSITEBASE][2] = j;
  226.     break;
  227.       case '^':
  228.     Level->site[i][j].showchar = WALL;
  229.     Level->site[i][j].locchar = FLOOR;
  230.     Level->site[i][j].p_locf = TRAP_BASE+random_range(NUMTRAPS);
  231.     lset(i,j,SECRET);
  232.     break;
  233.       case '"':
  234.     Level->site[i][j].locchar = HEDGE;
  235.     break;
  236.       case '~':
  237.     Level->site[i][j].locchar = WATER;
  238.     Level->site[i][j].p_locf = L_WATER;
  239.     break;
  240.       case '=':
  241.     Level->site[i][j].locchar = WATER;
  242.     Level->site[i][j].p_locf = L_MAGIC_POOL;
  243.     break;
  244.       case '>':
  245.     Level->site[i][j].locchar = DOWN;
  246.     Level->site[i][j].p_locf = L_SEWER;
  247.     break;
  248.       case '*':
  249.     Level->site[i][j].locchar = WALL;
  250.     Level->site[i][j].aux = 10;
  251.     break;
  252.       case '#':
  253.     Level->site[i][j].locchar = WALL;
  254.     Level->site[i][j].aux = 500;
  255.     break;
  256.       case '.':
  257.     Level->site[i][j].locchar = FLOOR;
  258.     break;
  259.       case ',':
  260.     Level->site[i][j].showchar = WALL;
  261.     Level->site[i][j].locchar = FLOOR;
  262.     Level->site[i][j].aux = NOCITYMOVE;
  263.     lset(i,j,SECRET);
  264.     break;
  265.       default:
  266.     Level->site[i][j].locchar = site;
  267.     break;
  268.       }
  269.  
  270.       if (loc_statusp(i,j,SEEN)) {
  271.     if (loc_statusp(i,j,SECRET))
  272.       Level->site[i][j].showchar = '#';
  273.     else Level->site[i][j].showchar = Level->site[i][j].locchar;
  274.       }
  275.     }
  276.     fscanf(fd,"\n");
  277.   }
  278.   City = Level;
  279.  
  280.   /* make all city monsters asleep, and shorten their wakeup range to 2 */
  281.   /* to prevent players from being molested by vicious monsters on */
  282.   /* the streets */
  283.   for(ml=Level->mlist;ml!=NULL;ml=ml->next) {
  284.     m_status_reset(ml->m,AWAKE);
  285.     ml->m->wakeup = 2;
  286.   }
  287.   fclose(fd);
  288. }
  289.  
  290.  
  291. void assign_city_function(x,y)
  292. int x,y;
  293. {
  294.   static int setup=0;
  295.   static int next=0;
  296.   static int permutation[64]; /* number of x's in city map */
  297.   int i,j,k,l;
  298.  
  299.   Level->site[x][y].aux = TRUE;
  300.  
  301.   lset(x,y+1,STOPS);
  302.   lset(x+1,y,STOPS);
  303.   lset(x-1,y,STOPS);
  304.   lset(x,y-1,STOPS);
  305.  
  306.  
  307.   if (setup == 0) {
  308.     setup = 1;
  309.     for(i=0;i<64;i++)
  310.       permutation[i] = i;
  311.     for(i=0;i<500;i++) {
  312.       j = random_range(64);
  313.       k = random_range(64);
  314.       l = permutation[j];
  315.       permutation[j] = permutation[k];
  316.       permutation[k] = l;
  317.     }
  318.   }
  319.   if (next > 63) { /* in case someone changes the no. of x's */
  320.     Level->site[x][y].locchar = CLOSED_DOOR;
  321.     Level->site[x][y].p_locf = L_HOUSE;
  322.     if(random_range(5)) Level->site[x][y].aux = LOCKED;
  323.   }
  324.   else switch(permutation[next]) {
  325.   case 0:
  326.     Level->site[x][y].locchar = OPEN_DOOR;
  327.     Level->site[x][y].p_locf = L_ARMORER;
  328.     CitySiteList[L_ARMORER-CITYSITEBASE][1] = x;
  329.     CitySiteList[L_ARMORER-CITYSITEBASE][2] = y;
  330.     break;
  331.   case 1:
  332.     Level->site[x][y].locchar = OPEN_DOOR;
  333.     Level->site[x][y].p_locf = L_CLUB;
  334.     CitySiteList[L_CLUB-CITYSITEBASE][1] = x;
  335.     CitySiteList[L_CLUB-CITYSITEBASE][2] = y;
  336.     break;
  337.   case 2:
  338.     Level->site[x][y].locchar = OPEN_DOOR;
  339.     Level->site[x][y].p_locf = L_GYM;
  340.     CitySiteList[L_GYM-CITYSITEBASE][1] = x;
  341.     CitySiteList[L_GYM-CITYSITEBASE][2] = y;
  342.     break;
  343.   case 3:
  344.     Level->site[x][y].locchar = CLOSED_DOOR;
  345.     Level->site[x][y].p_locf = L_THIEVES_GUILD;
  346.     CitySiteList[L_THIEVES_GUILD-CITYSITEBASE][1] = x;
  347.     CitySiteList[L_THIEVES_GUILD-CITYSITEBASE][2] = y;
  348.     break;
  349.   case 4:
  350.     Level->site[x][y].locchar = OPEN_DOOR;
  351.     Level->site[x][y].p_locf = L_HEALER;
  352.     CitySiteList[L_HEALER-CITYSITEBASE][1] = x;
  353.     CitySiteList[L_HEALER-CITYSITEBASE][2] = y;
  354.     break;
  355.   case 5:
  356.     Level->site[x][y].locchar = OPEN_DOOR;
  357.     Level->site[x][y].p_locf = L_CASINO;
  358.     CitySiteList[L_CASINO-CITYSITEBASE][1] = x;
  359.     CitySiteList[L_CASINO-CITYSITEBASE][2] = y;
  360.     break;
  361.   case 7: 
  362.     Level->site[x][y].locchar = OPEN_DOOR;
  363.     Level->site[x][y].p_locf = L_DINER;
  364.     CitySiteList[L_DINER-CITYSITEBASE][1] = x;
  365.     CitySiteList[L_DINER-CITYSITEBASE][2] = y;
  366.     break;
  367.   case 8: 
  368.     Level->site[x][y].locchar = OPEN_DOOR;
  369.     Level->site[x][y].p_locf = L_CRAP;
  370.     CitySiteList[L_CRAP-CITYSITEBASE][1] = x;
  371.     CitySiteList[L_CRAP-CITYSITEBASE][2] = y;
  372.     break;
  373.   case 6:
  374.   case 9: 
  375.   case 20: 
  376.     Level->site[x][y].locchar = OPEN_DOOR;
  377.     Level->site[x][y].p_locf = L_COMMANDANT;
  378.     CitySiteList[L_COMMANDANT-CITYSITEBASE][1] = x;
  379.     CitySiteList[L_COMMANDANT-CITYSITEBASE][2] = y;
  380.     break;
  381.   case 21:
  382.     Level->site[x][y].locchar = OPEN_DOOR;
  383.     Level->site[x][y].p_locf = L_TAVERN;
  384.     CitySiteList[L_TAVERN-CITYSITEBASE][1] = x;
  385.     CitySiteList[L_TAVERN-CITYSITEBASE][2] = y;
  386.     break;
  387.   case 10:
  388.     Level->site[x][y].locchar = OPEN_DOOR;
  389.     Level->site[x][y].p_locf = L_ALCHEMIST;
  390.     CitySiteList[L_ALCHEMIST-CITYSITEBASE][1] = x;
  391.     CitySiteList[L_ALCHEMIST-CITYSITEBASE][2] = y;
  392.     break;
  393.   case 11:
  394.     Level->site[x][y].locchar = OPEN_DOOR;
  395.     Level->site[x][y].p_locf = L_DPW;
  396.     CitySiteList[L_DPW-CITYSITEBASE][1] = x;
  397.     CitySiteList[L_DPW-CITYSITEBASE][2] = y;
  398.     break;
  399.   case 12:
  400.     Level->site[x][y].locchar = OPEN_DOOR;
  401.     Level->site[x][y].p_locf = L_LIBRARY;
  402.     CitySiteList[L_LIBRARY-CITYSITEBASE][1] = x;
  403.     CitySiteList[L_LIBRARY-CITYSITEBASE][2] = y;
  404.     break;
  405.   case 13:
  406.     Level->site[x][y].locchar = OPEN_DOOR;
  407.     Level->site[x][y].p_locf = L_PAWN_SHOP;
  408.     CitySiteList[L_PAWN_SHOP-CITYSITEBASE][1] = x;
  409.     CitySiteList[L_PAWN_SHOP-CITYSITEBASE][2] = y;
  410.     break;
  411.   case 14:
  412.     Level->site[x][y].locchar = OPEN_DOOR;
  413.     Level->site[x][y].p_locf = L_CONDO;
  414.     CitySiteList[L_CONDO-CITYSITEBASE][1] = x;
  415.     CitySiteList[L_CONDO-CITYSITEBASE][2] = y;
  416.     break;
  417.   case 15:
  418.     Level->site[x][y].locchar = CLOSED_DOOR;
  419.     Level->site[x][y].p_locf = L_BROTHEL;
  420.     break;
  421.   default:
  422.     Level->site[x][y].locchar = CLOSED_DOOR;
  423.     switch(random_range(6)) {
  424.     case 0: Level->site[x][y].p_locf = L_HOVEL; break;
  425.     case 1: case 2: case 3:
  426.     case 4: Level->site[x][y].p_locf = L_HOUSE; break;
  427.     case 5: Level->site[x][y].p_locf = L_MANSION; break;
  428.     }
  429.     if(random_range(5)) Level->site[x][y].aux = LOCKED;
  430.     break;
  431.   }
  432.   next++;
  433. }
  434.  
  435.   
  436.  
  437.  
  438. /* makes a hiscore npc for mansions */
  439. void make_justiciar(i,j)
  440. int i,j;
  441. {
  442.   pml ml = ((pml) malloc(sizeof(mltype)));
  443.   ml->m = ((pmt) malloc(sizeof(montype)));
  444.   *(ml->m) = Monsters[NPC];
  445.   make_hiscore_npc(ml->m,15);
  446.   ml->m->x = i;
  447.   ml->m->y = j;
  448.   Level->site[i][j].creature = ml->m;
  449.   ml->m->click = (Tick + 1) % 60;
  450.   ml->next = Level->mlist;
  451.   Level->mlist = ml;
  452.   m_status_reset(ml->m,AWAKE);
  453. }
  454.  
  455.  
  456.  
  457. /* loads the city level */
  458. void resurrect_guards()
  459. {
  460.   int i,j;
  461.   pml ml;
  462.   char site;
  463.   
  464.   FILE *fd;
  465.   
  466.   strcpy(Str3,OMEGALIB);
  467.   strcat(Str3,"ocity.dat");
  468.   fd = fopen(Str3,"r");
  469.  
  470.  
  471.   for(j=0;j<LENGTH;j++) {
  472.     for(i=0;i<WIDTH;i++) {
  473.       site = getc(fd);
  474.       if (site == 'G') {
  475.     make_site_monster(i,j,ML0+3);
  476.     Level->site[i][j].creature->monstring =
  477.       salloc("undead guardsman");
  478.     Level->site[i][j].creature->meleef = M_MELEE_SPIRIT;
  479.     Level->site[i][j].creature->movef = M_MOVE_SPIRIT;
  480.     Level->site[i][j].creature->strikef = M_STRIKE_MISSILE;
  481.     Level->site[i][j].creature->immunity = EVERYTHING-pow2(NORMAL_DAMAGE);
  482.     Level->site[i][j].creature->hp *= 2;
  483.     Level->site[i][j].creature->hit *= 2;
  484.     Level->site[i][j].creature->dmg *= 2;
  485.     Level->site[i][j].creature->ac *= 2;
  486.     m_status_set(Level->site[i][j].creature,HOSTILE);
  487.     m_status_set(Level->site[i][j].creature,AWAKE);
  488.       }
  489.     }
  490.     fscanf(fd,"\n");
  491.   }
  492.   City = Level;
  493.  
  494.   fclose(fd);
  495. }
  496.  
  497.  
  498. void mazesite(i,j)
  499. int i,j;
  500. {
  501.   static FILE *fd=NULL;
  502.   static int k=0;
  503.   char site;
  504.   if (fd==NULL) {
  505.     strcpy(Str2,OMEGALIB);
  506.     strcpy(Str4,"omaze .dat");
  507.     Str4[5]='1'+random_range(4);
  508.     strcat(Str2,Str4);
  509.     fd = fopen(Str2,"r");
  510.   }
  511.   site = getc(fd);
  512.   k++;
  513.   if (k == 282) fclose(fd);
  514.   switch(site) {
  515.   case '"':
  516.     Level->site[i][j].locchar = HEDGE;
  517.     if (random_range(10))
  518.       Level->site[i][j].p_locf = L_HEDGE;
  519.     else
  520.       Level->site[i][j].p_locf = L_TRIFID;
  521.     break;
  522.   case '-':
  523.     Level->site[i][j].locchar = CLOSED_DOOR;
  524.   case '.':
  525.     Level->site[i][j].locchar = FLOOR;
  526.     break;
  527.   case '>':
  528.     Level->site[i][j].locchar = DOWN;
  529.     Level->site[i][j].p_locf = L_SEWER;
  530.     break;
  531.   case 'z':
  532.     Level->site[i][j].locchar = FLOOR;
  533.     Level->site[i][j].p_locf = L_MAZE;
  534.     break;
  535.   case 'O':
  536.     Level->site[i][j].locchar = OPEN_DOOR;
  537.     Level->site[i][j].p_locf = L_ORACLE;
  538.     CitySiteList[L_ORACLE-CITYSITEBASE][1] = i;
  539.     CitySiteList[L_ORACLE-CITYSITEBASE][2] = j;
  540.     break;
  541.   case '?':
  542.     randommazesite(i,j);
  543.     break;
  544.   }
  545.   lreset(i,j,SEEN);
  546. }
  547.  
  548. void randommazesite(i,j)
  549. int i,j;
  550. {
  551.   switch(random_range(7)) {
  552.   case 0: case 1:
  553.     Level->site[i][j].locchar = FLOOR;
  554.     Level->site[i][j].p_locf = TRAP_BASE+random_range(NUMTRAPS);
  555.     break;
  556.   case 2: case 3:
  557.     Level->site[i][j].locchar = FLOOR;
  558.     make_site_monster(i,j,-1);
  559.     break;
  560.   case 4: case 5:
  561.     Level->site[i][j].locchar = FLOOR;
  562.     make_site_treasure(i,j,5);
  563.     break;
  564.   default:
  565.     Level->site[i][j].locchar = FLOOR;    
  566.   }
  567. }
  568.  
  569.  
  570. /* undead are not hostile unless disturbed.... */
  571. void make_minor_undead(i,j)
  572. int i,j;
  573. {
  574.   int mid;
  575.   if (random_range(2)) mid = ML2+6; /*ghost */
  576.   else mid = ML4+5; /*haunt*/
  577.   make_site_monster(i,j,mid);
  578.   m_status_reset(Level->site[i][j].creature,AWAKE);
  579.   m_status_reset(Level->site[i][j].creature,HOSTILE);
  580. }    
  581.  
  582. /* undead are not hostile unless disturbed.... */
  583. void make_major_undead(i,j)
  584. int i,j;
  585. {
  586.   int mid;
  587.   if (random_range(2)) mid = ML6+5; /* lich */
  588.   else mid = ML9+5; /*vampire lord*/
  589.   make_site_monster(i,j,mid);
  590.   m_status_reset(Level->site[i][j].creature,AWAKE);
  591.   m_status_reset(Level->site[i][j].creature,HOSTILE);
  592. }    
  593.  
  594.  
  595. static char jail[11][5] = 
  596. {
  597.    '#', '#', '*', '#', '#', '*', '#', '#', '*', '#', '#',
  598.    '#', '#', '*', '#', '#', '*', '#', '*', '#', '#', '#',  
  599.    '#', '#', 'T', '#', 'T', '#', 'T', '#', 'T', '#', '#',  
  600.    '#', '#', '7', '#', '7', '#', '7', '#', '7', '#', '#',  
  601.    '#', '#', 'R', '#', 'R', '#', 'R', '#', 'R', '#', '#', 
  602. };
  603.  
  604. /* fixes up the jail in case it has been munged by player action */
  605. void repair_jail()
  606. {
  607.   int i,j;
  608.   for(i=0;i<11;i++)
  609.     for(j=0;j<5;j++) {
  610.       switch(jail[i][j]) {
  611.       case '#':
  612.     City->site[i+35][j+52].locchar = WALL;
  613.     City->site[i+35][j+52].p_locf = L_NO_OP;
  614.     City->site[i+35][j+52].aux = 666;
  615.     break;
  616.       case '*':
  617.     City->site[i+35][j+52].locchar = WALL;
  618.     City->site[i+35][j+52].p_locf = L_NO_OP;
  619.     City->site[i+35][j+52].aux = 10;
  620.     break;
  621.       case 'T':
  622.     City->site[i+35][j+52].locchar = FLOOR;
  623.     City->site[i+35][j+52].p_locf = L_PORTCULLIS_TRAP;
  624.     City->site[i+35][j+52].aux = NOCITYMOVE;
  625.     break;
  626.       case '7':
  627.     City->site[i+35][j+52].locchar = FLOOR;
  628.     City->site[i+35][j+52].p_locf = L_PORTCULLIS;
  629.     City->site[i+35][j+52].aux = NOCITYMOVE;
  630.     break;
  631.       case 'R':
  632.     City->site[i+35][j+52].locchar = FLOOR;
  633.     City->site[i+35][j+52].p_locf = L_RAISE_PORTCULLIS;
  634.     City->site[i+35][j+52].aux = NOCITYMOVE;
  635.     break;
  636.       }
  637.     }
  638. }
  639.